<template>
  <div class="header">
    <div class="l-content">
      <el-button @click="expandMenuChange" size="small" icon="Operation" style="margin-right: 15px;"></el-button>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>promotion list</el-breadcrumb-item>
        <el-breadcrumb-item>promotion detail</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="r-content">
      <el-dropdown>
        <span class="el-dropdown-link">
          <img src="../assets/images/user.jpg" alt />
          <el-icon class="el-icon--right">
            <arrow-down />
          </el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item>个人中心</el-dropdown-item>
            <el-dropdown-item @click="handleLoginOut">退出</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
  </div>
</template>
<script setup>
import { ref, computed } from "vue"
import { useAllDataStore } from "@/stores/index.js"
import { useRouter } from "vue-router"

// 在组件内部的任何地方均可以访问变量 `store` ✨
const store = useAllDataStore()
const expandMenuChange = () => {
  store.changeCollapse(!store.state.collapse)
}
const router = useRouter()
const handleLoginOut = () => {
  //执行重置方法
  store.clearn()

  router.push("/login")
}
</script>
<style scoped lang="less">
.header {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  background-color: #333;
  padding: 0 10px;

  &>div {
    display: flex;
    align-items: center;
  }
}

.r-content {
  img {
    width: 25px;
    height: 25px;
    border-radius: 50%;
  }
}

/deep/ .el-breadcrumb__inner {
  color: #fff !important;
}
</style>